package com.dxf.sysadmin.controller;

import com.dxf.common.utils.ResultJson;
import com.dxf.sysadmin.entity.Clazz;
import com.dxf.sysadmin.entity.Course;
import com.dxf.sysadmin.entity.qo.ClazzQo;
import com.dxf.sysadmin.entity.qo.CourseQo;
import com.dxf.sysadmin.service.ClazzService;
import com.dxf.sysadmin.service.CourseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/course")
@Api(tags  = "CourseController|课程控制器")
public class CourseController {
    @Autowired
    private CourseService courseService;

    /**
     * @Description: 课程列表分页查询
     */
    @PostMapping("coursePage")
    @ApiOperation("课程列表分页查询")
    public ResultJson coursePage(@RequestBody CourseQo qry){
        return courseService.coursePage(qry);
    }

    /**
     * @Description: 更具id列表删除课程
     */
    @PostMapping("delete")
    @ApiOperation(value = "更具id列表删除课程")
    public ResultJson deleteCourse(@RequestParam("list[]") List<Long> list){
        return courseService.deleteCourse(list);
    }

    /**
     * @Description: 新增或者更新课程
     */
    @PostMapping("saveOrUpdate")
    @ApiOperation(value="新增或者更新课程")
    public ResultJson saveOrUpdateCourse( @RequestBody Course clazz){
        return courseService.saveOrUpdateCourse(clazz);
    }
}
